#include  <map>
#include  <cstdio>
#include  <iostream>
#include  <string>
#include  <cstring>
#include  <ctype.h>
using namespace std;

int main(int argc, char *argv[])
{
	map<string,int> m;
	char ss[100];
	int n;
	scanf("%d",&n);

	for( int i = 0 ; i < n ; ++i )
	{
		char num[9];
		scanf("%s",ss);
		int len = strlen(ss), index = 0;

		for( int j = 0; j < len ; ++j )
		{
			if( isupper(ss[j]) )
			{
				char c;
				if( ss[j] <= 'O' && ss[j] >= 'A' )
					c = (ss[j]-'A')/3 + 2 + '0';
				else if (ss[j]=='P'||ss[j]=='R'||ss[j]=='S')
					c = '7';
				else if(ss[j]=='T'||ss[j]=='U'||ss[j]=='V')
					c = '8';
				else if(ss[j]=='W'||ss[j]=='X'||ss[j]=='Y') 
					c = '9';

				num[index++] = c;
			}
			else if(isdigit(ss[j]))
				num[index++] = ss[j];

			if(index == 3)
				num[index++] = '-';
		}
	

		num[8] = '\0';
		m[num]++;
	}
	
	map<string,int>::iterator itr = m.begin();
	int count = 0;
	for( ; itr != m.end() ; ++itr )
		if(itr->second > 1)
		{
			printf("%s %d\n", itr->first.c_str(),itr->second);
			count++;
		}
	if(count==0)
		printf("No duplicates.\n");
	
}
